package com.alex.space.commons.jdk.kit8;

/**
 * @author Alex
 *         Created by Alex on 2017/12/22.
 *         <p>
 *         JDK8
 */
public class Kit8Tests {

    public static void main(String[] args) {

        //方法引用
        PersonFactory<Person> personFactory = Person::new;
        Person person = personFactory.create("Peter", "Parker");
        System.out.println(person.firstName + " " + person.lastName);

        //DateTime API
        DateDemo.run();

        //函数式接口
        FunctionalDemo.run();

        //接口默认方法
        Formula formula = new Formula() {
            @Override
            public double calculate(int a) {
                return sqrt(a * 10);
            }
        };
        formula.calculate(10);
        formula.sqrt(10);

        //lambda表达式
        LambdaDemo.run();

        //Stream
        StreamDemo.run();
    }
}
